package com.example.controller;

import com.example.entity.ReqStuInfoForm;
import com.example.entity.RspStuInfoForm;
import com.example.entity.Student;
import com.example.service.StudentService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/student/info")
public class StudentController {

    @Resource
    private StudentService studentService;

    @PostMapping("/get-score")
    public RspStuInfoForm getScore(@RequestBody ReqStuInfoForm reqStuInfoForm){
        Student student = studentService.getStudentById(reqStuInfoForm.getId());
        RspStuInfoForm resStuInfoForm = new RspStuInfoForm();
        resStuInfoForm.setChinese(student.getChinese());
        resStuInfoForm.setMath(student.getMath());
        resStuInfoForm.setEnglish(student.getEnglish());
        return resStuInfoForm;
    }
}
